package com.zhu.esyblog.controller;


import com.zhu.esyblog.pojo.RespBean;
import com.zhu.esyblog.service.ITagService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author stx
 * @since 2022-06-22
 */
@RestController
@RequestMapping("/tags")
@Api(tags = "文章标签模块")
public class TagController {

    @Autowired
    private ITagService tagService;
       @ApiOperation(value = "最热标签")
       @GetMapping("/hot")
       public RespBean hot(){
          int limit=6;
         return tagService.hots(limit);
      }
    @ApiOperation(value = "所有标签")
    @GetMapping("/detail")
    public RespBean findAllDetail(){
           return tagService.findAllDetail();
    }

    @ApiOperation(value = "根据id查询标签")
    @GetMapping("/detail/{id}")
    public RespBean findAllDetailById(@PathVariable("id")Long id){
        return tagService.findAllDetailById(id);
    }

}
